package com.hjt.gulimall.order.service;

import com.alipay.api.AlipayApiException;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hjt.common.utils.PageUtils;
import com.hjt.gulimall.order.entity.OrderEntity;
import com.hjt.gulimall.order.vo.OrderConfirmVo;
import com.hjt.gulimall.order.vo.OrderSubmitResponseVo;
import com.hjt.gulimall.order.vo.OrderSubmitVo;
import com.hjt.gulimall.order.vo.PayAsyncVo;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * 订单
 *
 * @author huangjingtai
 * @email 970075985@qq.com
 * @date 2021-09-08 20:05:31
 */
public interface OrderService extends IService<OrderEntity> {

    PageUtils queryPage(Map<String, Object> params);

    // 获取订单页信息
    OrderConfirmVo getOrderConfirmVo() throws ExecutionException, InterruptedException;

    // 下单
    OrderSubmitResponseVo submitOrder(OrderSubmitVo orderSubmitVo);

    // 根据订单号,获取订单信息
    OrderEntity getByOrderSn(String orderSn);

    // 关闭订单
    void closeOrder(OrderEntity order);

    String pay(String orderSn) throws AlipayApiException;

    // 查询用户的所有订单以及订单项
    PageUtils pageWithItem(Map<String, Object> params);

    // 处理支付宝支付结果
    String handlePayResult(PayAsyncVo vo);
}

